Here we have some example plotting libraries in iPython


In [4]:
import pandas
fname2 = '/Users/astyler/projects/ChargeCarData/csv/illah20100227_0.csv'
df = pandas.read_csv(fname2)
df.dtypes
#df


Out[4]:
Latitude           float64
Longitude          float64
Elevation          float64
Bearing            float64
PlanarDistance     float64
Speed              float64
Acceleration       float64
Power              float64
TotalEnergyUsed    float64
PeriodMS             int64
Time                 int64
dtype: object

Pylab can plot 2d data, but it is really just a skin of scilab, numpy, and matplotlib


In [7]:
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import math

%matplotlib inline
rows = [df.iloc[i] for i in xrange(len(df))]
fig = plt.figure(figsize=(12,12))
ax = fig.add_subplot(111)
length = 0.00005
width = 0.00001
head_width = 0.00003
for r in rows:
    dlon = length * math.cos(r.Bearing)
    dlat = length * math.sin(r.Bearing)
    ax.arrow(r.Longitude,r.Latitude,dlon,dlat,width=width, head_width=head_width)
    
plt.xlim([min(df.Longitude),max(df.Longitude)])
plt.ylim([min(df.Latitude),max(df.Latitude)])


Out[7]:
(40.429896999999997, 40.432600000000001)

Matplotlib can plot interactive plots in iPython as well, but takes a lot of effort to make pretty graphs


In [4]:
%matplotlib notebook
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

p = plt.figure().gca(projection='3d')
p.plot(df.Longitude, df.Latitude, df.Power)
p.set_xlabel('Lon')
p.set_ylabel('Lat')
p.set_zlabel('Power')
plt.show()



In [5]:
import bokeh.plotting as bp
bp.output_notebook()
p2 = bp.figure(title='Trip plot',tools = "pan,wheel_zoom,box_zoom,reset,resize",toolbar_location='below')
p2.line(df.Longitude, df.Latitude)
bp.show(p2)


BokehJS successfully loaded.

Plotly creates a plot remotely on plotly servers, and serves it up over http. Not accessable without an internet connection, but very pretty and smart labeling.


In [6]:
import plotly.plotly as py
from plotly.graph_objs import *
plotlayout = Layout(
    title='Trip plot',
    scene=Scene(
        xaxis=XAxis(
            title='Longitude'
        ),
        yaxis=YAxis(
            title='Latitude'
        ),
        zaxis=ZAxis(
            title='Power (Watts)'
        )
    )
)
fig = Figure(data=[Scatter3d(x=df.Longitude, y=df.Latitude, z=df.Power,mode='lines')], layout=plotlayout)
py.iplot(fig, filename = 'triptestplot')


Out[6]: